# Contributor: Kaarle Ritvanen <kunkku@alpinelinux.org>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-factory-boy
_pkgname=factory_boy
pkgver=3.3.0
pkgrel=3
pkgdesc="A versatile test fixtures replacement based on thoughtbot's factory_girl for Ruby"
url="https://github.com/FactoryBoy/factory_boy"
arch="noarch"
license=MIT
depends="python3 py3-faker"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="
	py3-mock py3-django py3-sqlalchemy-utils py3-pytest py3-flask-sqlalchemy
"
subpackages="$pkgname-pyc"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/FactoryBoy/factory_boy/archive/$pkgver.tar.gz
	disable-mongoengine.patch
	disable-tests-version.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-factory-boy" # Backwards compatibility
provides="py-factory-boy=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	DJANGO_SETTINGS_MODULE=tests.djapp.settings .testenv/bin/python3 -m pytest -v
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
483e7454dbbafdf6ba2ec8924ccd648585c5ad5676da0af222a942beb3ebdbf4c372bb963c948d8a87a5359c1277b45b226239ff6109e11dbc1851ef5fd7275f  py3-factory-boy-3.3.0.tar.gz
a463f2c1100889841a04331bb2bec3d1697fb456e06ec878767b9fd56cecf4d5e245b9816d69cfe027a567dbf43815508d23bbcd9d0d52e0b5fe5c2aa933c408  disable-mongoengine.patch
73b027b3b7d69cf302cdc06a87b7639e776c30d6d58d4b3fb7edfe78ba9c09e5589526a60726a03c7b78364f7e849000f31112fe4569593cbc513a47274c42f4  disable-tests-version.patch
"
